<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

require APPPATH . '/libraries/ceklogin.php';

class braintest extends CekLogin {

    public function index() {
        $session = $this->session->userdata('log_in');
        $data['session'] = $session;
        $data['halaman'] = 'braintest';
        $this->load->model(array('quiz_model'));
        //$data['list_braintest'] = $this->braintest_model->get_list_braintest();
        //$this->load->view('braintest/select', $data);
        $data['list_braintest'] = $this->quiz_model->getListQuiz();
        $this->load->view('braintest/braintest',$data);
    }
    public function index2() {
        $session = $this->session->userdata('log_in');
        $data['session'] = $session;
        $data['halaman'] = 'braintest';
        $this->load->view('braintest/select', $data);
    }

    public function create() {
        $session = $this->session->userdata('log_in');
        $data['session'] = $session;
        $data['halaman'] = 'braintest';
        $this->load->view('braintest/create', $data);
    }

    public function do_create() {
        $session = $this->session->userdata('log_in');
        $nama_braintest = $this->input->post('nama_braintest');
        $deskripsi = $this->input->post('deskripsi');
        $waktuMulai = $this->input->post('waktu_mulai');
        $waktuSelesai = $this->input->post('waktu_selesai');
        $this->load->model(array('quiz_model'));
        $res = $this->quiz_model->tambahQuiz($nama_braintest, $deskripsi, $waktuMulai, $waktuSelesai);
        echo "please wait....";
        redirect(base_url().'braintest/buatSoal?id='.$res);
        //var_dump($res);
    }

    public function kerjakan() {
        $session = $this->session->userdata('log_in');
        $data['session'] = $session;
        $data['halaman'] = 'braintest';
        $this->load->view('braintest/kerjakan', $data);
    }

    public function selesai() {
        $session = $this->session->userdata('log_in');
        $data['session'] = $session;
        $data['halaman'] = 'braintest';
        $this->load->view('braintest/selesai', $data);
    }
    public function buatSoal(){
        $session = $this->session->userdata('log_in');
        $data['session'] = $session;
        $data['halaman'] = 'braintest';
        $this->load->view('braintest/tambah_soal', $data);
    }

}

?>